package meihua.stopcarapp.presenter.contract;

import java.util.List;

import meihua.mylibrary.base.BaseModel;
import meihua.mylibrary.base.BasePresenter;
import meihua.stopcarapp.bean.ParkingEntity;
import meihua.stopcarapp.bean.result.LadvanceResult;
import meihua.stopcarapp.bean.result.LockResult;
import meihua.stopcarapp.bean.result.UnLadvanceResult;
import meihua.stopcarapp.bean.result.UserResult;
import meihua.stopcarapp.ui.BaseView;
import rx.Observable;

/**
 * Name: LGZ
 * Time: 2017/5/6.
 * Dec:
 */

public class ParkingContract {

    public interface Model extends BaseModel {
        //获取用户个人信息
        Observable<UserResult> getUserById(String uid, String phone);
        //获取车位列表（参数经纬度）
        Observable<List<ParkingEntity>> getParkingList(String longitude, String latitude);
        //预约车位
        Observable<LadvanceResult> secdLadvance(String phone, String parking_list_num);
        //取消预约车位
        Observable<UnLadvanceResult> secdUnLadvance(String adv_id, String phone, String parking_list_num);
        //开锁
        Observable<LockResult> secdOpenLock(String phone, String parking_list_num);
    }

    public interface View extends BaseView {
        //服务器返回的用户信息
        void returnUserInfo(UserResult userEntity);
        //返回获取的列表信息
        void returnParkingList(List<ParkingEntity> parkings);
        //预约成功返回数据
        void returnsecdLadvance(LadvanceResult ladvance);
        //取消预约预约成功返回数据
        void returnsecdUnLadvance(UnLadvanceResult ladvance);
        //开锁返回数据
        void returnOpenLock(LockResult ladvance);
    }

    public abstract static class Presenter extends BasePresenter<View, Model> {
        //发起请求
        public abstract void sendGetUser(String uid, String phone);
        //发起获取列表请求
        public abstract void getParkingListRequest(String longitude, String latitude);
        //发起预约请求
        public abstract void getsecdLadvanceRequest(String phone, String parking_list_num);
        //发起取消预约请求
        public abstract void getsecdUnLadvanceRequest(String adv_id, String phone, String parking_list_num);
        //发起开锁请求
        public abstract void getsecdOpenLockRequest(String phone, String parking_list_num);
    }

}
